<template>
<div>
  <template v-for="i in list">
    <el-row type="flex">
      <el-col>
        <p style="color:#30d4ff;">{{ i.user_name }}</p>
      </el-col>
      <el-col>
        <p>{{i.name}}</p>
      </el-col>
      <el-col>
        <p style="color: red">{{i.salary}}</p>
      </el-col>
      <el-col>
        <el-button @click="btn(i.user_id,i.job_id)">约面试</el-button>
      </el-col>
    </el-row>
  </template>

  <el-dialog :visible.sync="vis">
    <el-form :model="form" ref="form">
      <el-form-item label="面试时间" prop="date">
        <el-date-picker
            align="center"
            placeholder="选择面试时间"
            type="datetime"
            v-model="form.date"
            value-format="timestamp">

        </el-date-picker>
      </el-form-item>
      <el-form-item label="面试地点" prop="site">
        <el-input v-model="form.site"/>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submit">约面试</el-button>
      </el-form-item>
    </el-form>
  </el-dialog>
</div>
</template>

<script>
import jobs from "@/utils/api/jobs";

export default {
  name: "interview",
  data(){
    return{
      form:{
        date:'',
        site:'',
        userId:'',
        jobId:''
      },
      vis:false,
      list:[],
    }
  },
  mounted() {
    jobs.pass().then(res=>{
      this.list=res.data.data
    })
  },
  methods:{
    submit(){
      //插入数据库
       jobs.interview(this.form).then(()=>{
         this.$message.success("预约成功")
       })
      //重置
      this.$refs.form.resetFields()
      //关闭
      this.vis=false
    },
    btn(uid,jid){
      this.form.jobId=jid
      this.form.userId=uid
      this.vis=true
    }
  }
}
</script>

<style scoped>

</style>